package cms.jason.entity;

import com.cn.lotary.base.dao.AbstractEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Jason
 */
@Entity
@Table(catalog = "cms", name = "article", schema = "")
@XmlRootElement
public class Article extends AbstractEntity {

    private static final long serialVersionUID = 1L;
    @Lob
    @Size(max = 65535)
    @Column(length = 65535)
    private String content;
    @Size(max = 45)
    @Column(length = 45)
    private String title;
    @JoinColumn(name = "article_site", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private ArticleSite articleSite;
    @JoinColumn(name = "article_type", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private ArticleType articleType;

    public Article() {
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public ArticleSite getArticleSite() {
        return articleSite;
    }

    public void setArticleSite(ArticleSite articleSite) {
        this.articleSite = articleSite;
    }

    public ArticleType getArticleType() {
        return articleType;
    }

    public void setArticleType(ArticleType articleType) {
        this.articleType = articleType;
    }

    @Override
    public String toString() {
        return "Article{" + "content=" + content + ",title=" + title + '}';
    }
}
